<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<style type="text/css">
    td{
        text-align:center;
    }
</style>
<script>
function submitForm(op){
	 ac.action="select_"+op+".action";
	 ac.submit();
}
/* $("#shangchuan").click(function(){
	var url = "uploadF?time="+ new Date().getTime();
	var sendData = null;
	$.post(url,sendData,function(data){
		alert(data);
	})
}) */
</script>
</head>
<body>
<!-- <form action="uploadF" method="post" enctype="multipart/form-data">
         请先上传图书照片：<input type="file" name="picture">
    <input type="submit" value="上传">
    </form> -->
    <form action="add" method="post" enctype="multipart/form-data">
     <table>
           <tr>
              <td>图书名字：</td>
              <td><input type="text" name="book.bookname"></td>
           </tr>
           <tr>
              <td>图书作者：</td>
              <td><input type="text" name="book.author"></td>
           </tr>
           <tr>
              <td>出版社：</td>
              <td><input type="text" name="book.publish"></td>
           </tr>
           <tr>
              <td>售价：</td>
              <td><input type="text" name="book.price"></td>
           </tr>
           <tr>
              <td>入库数量：</td>
              <td><input type="text" name="book.currcount"></td>
           </tr>
           <tr>
              <td>图书照片：</td>
              <td>
                <input  type="file" name="picture">
              </td>
           </tr>
           <tr>
              <td colspan="2"><input type="submit" value="添加"></td>
           </tr>
     </table>
     </form>
     <div>&nbsp;</div>
     <form name="ac">
     <div>按出版社查询：<input tyep="text" name="book.publish">
     <input type="submit" value="查询" onclick="submitForm('selectPublish')" class="select"></div>
     <div>&nbsp;</div>
     <div>按当前库存查询：<input tyep="text" name="book.currcount">
     <input type="submit" value="查询" onclick="submitForm('selectCurrcount')" class="select"></div>
     <div>&nbsp;</div>
     </form>
     <table>
           <tr>
              <th>图书编号</th>
              <th>图书照片</th>
              <th>图书名字</th>
              <th>图书作者</th>
              <th>出版社</th>
              <th>售价</th>
              <th>入库数量</th>
              <th>操作</th>
           </tr>
            <c:forEach items="${sessionScope.list}" var="b">
           <tbody>
             <tr>
             <td>${b.bookid }</td>
             <td><img src="/bookpicture/${b.picture}" width="50px" height="50px"></td>
             <td>${b.bookname }</td>
             <td>${b.author }</td>
             <td>${b.publish }</td>
             <td>${b.price }</td>
             <td>${b.currcount }</td>
             <td><a href="${pageContext.request.contextPath}delete?book.bookid=${b.bookid }">删除</a></td>
             </tr>
           </tbody>
           </c:forEach>
     </table>
</body>
</html>